//通用api请求
//import axios from "axios";
//原版axios请求注释
// const getCaptcha=async()=>{
//   let result='';
//   let imgCodeToken=Tool.get8UUID(8);
//   try{
//       result=await axios.get(process.env.VUE_APP_SERVER +'/business/member/captcha/code/'+imgCodeToken)
//       if(result.status===200){
//           return result;
//       }
//   } catch(e){
//       console.log("请求失败！",e);
//   }

//   return result;
// }


//改用全局axios-instance
import axios from "../utils/request";
const getCaptcha=()=>{
  let imgCodeToken = Tool.get8UUID(8);
  return axios.get(process.env.VUE_APP_SERVER +'/business/member/captcha/code/'+imgCodeToken)
}

//原不带参数封装的axios请求
// const getCaptchaAx=()=>{
//   let imgCodeToken = Tool.get8UUID(8);
//   /** 等价于
//    * axios.request({
//    *  method:'get',
//    *  url:'/business/member/captcha/code/'
//    * })
//    */
//   return axios.get('/business/member/captcha/code/'+imgCodeToken)
// }

const getCaptchaAx=(SID)=>{
  let imgCodeToken = Tool.get8UUID(8);
  //get请求携带参数
  return axios.get('/business/member/captcha/code/',{
    params:{
      SID:SID
    }
  })
}

const sendEmailAxios=(option)=>{
  return axios.post('/system/member/sendHtmlMail',{...option})
}

const loginAxios=(member)=>{
  return axios.post('/system/member/loginIn',{...member})
}
export { getCaptcha,getCaptchaAx,sendEmailAxios,loginAxios};